import QtQuick
import QtQuick.Controls

Rectangle {
    width: 400
    height: 400

    AnimatedImage {
        id: controlImg
        source: "qrc:/images/huaji.gif"
        x: 0
        y: 150
        width: 100
        height: 100
    }

    NumberAnimation {
        id: controlledAnim
        target: controlImg
        property: "x"
        from: 0
        to: 300
        duration: 1500
    }

    Row {
        anchors.bottom: parent.bottom
        spacing: 10

        Button {
            text: "开始"
            onClicked: controlledAnim.start()
        }

        Button {
            text: "暂停"
            onClicked: controlledAnim.pause()
        }

        Button {
            text: "恢复"
            onClicked: controlledAnim.resume()
        }

        Button {
            text: "停止"
            onClicked: controlledAnim.stop()
        }

        Button {
            text: "重启"
            onClicked: controlledAnim.restart()
        }
    }
}
